package com.bowen.chapter06.refactor;

import com.bowen.chapter06.refactor.type.EngineerType;
import com.bowen.chapter06.refactor.type.SalesmanType;
import com.bowen.except.EmployeeTypeInValidException;

public class Entry {

    public static void main(String[] args) throws EmployeeTypeInValidException {
        Employee.createEmployee("Cheshijun", "Programmer");
        Employee.createEmployee("Doudong", "Experienced");
        // 注意!!!这里使用了字面量类型，茂杰在【重构API】中提到了【以查询取代参数】(这里员工类型可以是某个查询方法取到)
        // 但这是Demo而已，正常业务逻辑可能是从数据库中/配置表中映射出来的数据。也就是非字面量值
        // 但是这里提供了另外一种处理方案，员工类型可变
        Employee.createEmployee("Cheshijun", new EngineerType());
        Employee.createEmployee("Doudong", new SalesmanType());
    }

}
